<?php
ini_set("display_errors", "On");
error_reporting(E_ALL);

// 引入数据库连接文件
require_once '../../../sql/connection.php';

if ($_POST['authYID']){
	$id = $_POST['authYID'];
	$authCode = 1;
}
else{
	$id = $_POST['authNID'];
	$authCode = -1;
}

$now = date('Y-m-d H:i:s', time());
$editSql = "UPDATE student_info set update_time = '$now', is_auth = '$authCode' where id = '$id'";
if (mysqli_query($GLOBALS['conn'], $editSql)) {
	echo "
            <script>
                alert('验证操作成功！');
                window.location.href=document.referrer;
            </script>
        ";
} else {
	echo "
            <script>
                alert('验证操作失败！');
                history.back();
            </script>
        ";
}
